package fanshe.first.demo01;

/**
 * @author Mr.ma
 * @since 2022/10/27 15:20
 * 获取反射类，三种方法
 *      1、类名.class，返回带类泛型的Class
 *      2、对象名.getClass，返回带泛型上限的Class
 *      3、Class.forName("全限定类名")，bean对象创建，注册驱动等，抛出异常
 * 三种方式获取到的反射类相同
 **/
public class Test01 {
    public static void main(String[] args) throws Exception {
        Class<Student> studentClass = Student.class;
        Student student = new Student();
        Class<? extends Student> aClass = student.getClass();
        Class<?> aClass1 = Class.forName("fanshe.first.demo01.Student");
        System.out.println("aClass1 = " + aClass1);
        System.out.println("aClass = " + aClass);
        System.out.println("studentClass = " + studentClass);
    }
}
